home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 15 Orphan Computers / SIMCAL.TXT < prev    next >
Text File  |  2019-04-13  |  10KB  |  322 lines

  1.  
  2.  
  3.  10 dim v(15,60),x$(50),v$(15,60):cr$=chr$(147):ct$="-----calculating ----"
  4.  20 dim l$(50):printcr$
  5.  30 printcr$
  6.  35 print"------column calculator-------"
  7.  40 print"    1.  view columns
  8.  50 print"    2.  enter data
  9.  60 print"    3.  do calculations
  10.  70 print"    4.  zero matrix
  11.  80 print"    5.  get data from tape
  12.  90 print"    6.  put data back on tape
  13.  100 print"    7.  memory check
  14.  110 print"    8. print data on printer"
  15.  120 print
  16.  130 print"    what is your choice?"
  17.  140 get an$:if an$="" then 140
  18.  150 on val(an$)gosub 250,1120,1270,180,740,910,1070,2860
  19.  160 goto 30
  20.  170 rem zero  matrix
  21.  180 printcr$
  22.  185 print"zeroing matrix..col >           "
  23.  190 for x=1 to 15:printchr$(145)tab(22)x
  24.  200 for y=1 to 50
  25.  210 v(x,y)=0
  26.  220 nexty
  27.  230 nextx
  28.  240 return
  29.  250 rem set  up display
  30.  260 printcr$
  31.  270 input "enter column(1 to 13):";c%
  32.  280 if c%<1 or c%>13 then printcr$;:goto270
  33.  290 print:input "enter row (1 to 31):";r%
  34.  300 if r%<1 or r%>31 then printcr$;:goto290
  35.  310 printcr$;:gosub 580
  36.  320 printchr$(19)chr$(17)
  37.  330 for y=r% to r%+19
  38.  340 printtab(9);
  39.  350 for x=c% to c%+2
  40.  360 x$=str$(v(x,y))
  41.  370 printspc(10-len(x$));x$;
  42.  380 next
  43.  390 printchr$(13);
  44.  400 next
  45.  410 printchr$(17)"enter (u)p,(d)wn,(l)ft,(r)ht,(j)mp or (m)enu";
  46.  420 get c$:if c$="" then 420
  47.  430 rem if c$=up then decrease row by 1
  48.  440 if c$="u" then r%=r%-1:printchr$(13):goto300
  49.  450 rem if c$=down then increase row by 1
  50.  460 if c$="d" then r%=r%+1:printchr$(13):goto300
  51.  470 rem if c$=left then decrease colm by 1
  52.  480 if c$="l" then c%=c%-1:goto550
  53.  490 rem if c$=right then increase colm by 1
  54.  500 if c$="r" then c%=c%+1:goto550
  55.  510 rem if c$=jump enter new row and colm if c$=m,go back to menu
  56.  520 if c$="j" then 260
  57.  530 if c$="m" then return
  58.  540 goto 420:rem reject any other c$ input
  59.  550 if c%<1 then c%=1:goto420
  60.  560 ifc%>13thenc%=13:goto420
  61.  570 goto 310
  62.  580 rem create row and colm headers
  63.  590 printtab(9);
  64.  600 for i=1 to 3
  65.  610 printchr$(18)"    column";
  66.  620 next
  67.  630 printchr$(13);tab(9);
  68.  640 for i=c% to c%+2
  69.  650 s%=7:if i<10 then s%=8
  70.  660 printspc(s%);chr$(18);str$(i);chr$(146);
  71.  670 next
  72.  680 printchr$(13);
  73.  690 for i=r% to r%+19
  74.  700 s%=1:if i<10 then s%=2
  75.  710 printtab(2)chr$(18);"row";spc(s%);str$(i)"
  76.  720 next
  77.  730 return
  78.  740 rem get data from tape
  79.  750 input"what is name of file you want";fl$
  80.  760 print:print"make sure tape is ready..push any key when ready"
  81.  770 print"push 'm' to return to menu"
  82.  780 geta$:ifa$=""then780
  83.  790 ifa$="m"then return
  84.  800 printcr$"looking for ";fl$
  85.  810 open1,1,0,(fl$)
  86.  820 print"found ";fl$;" .....loading"
  87.  830 for x=1 to 12:print"loading data into col"x
  88.  840 for y=1 to 49
  89.  850 input#1,v(x,y)
  90.  860 next y
  91.  870 next x
  92.  880 close 1:print"ok.....got data"
  93.  890 for i=1 to 1000:next i
  94.  900 return
  95.  910 rem put data on disk
  96.  920 input"what do you want to name this file";fl$
  97.  930 print"make sure tape is rewound,hit any key when ready"
  98.  940 print"push 'm' to return to menu"
  99.  950 geta$:if a$="" then 950
  100.  960 ifa$="m"then return
  101.  970 printcr$"----putting data on disk--------   "
  102.  980 open1,1,2,(fl$)
  103.  990 for x=1 to 12:print"storing data from col"x
  104.  1000 for y=1 to 49
  105.  1010 print#1,v(x,y)
  106.  1020 next y
  107.  1030 next x
  108.  1040 close1:print"ok.....data on disk"
  109.  1050 for i=1 to1000:next i
  110.  1060 return
  111.  1070 rem memeory check
  112.  1080 printfre(a)
  113.  1090 for i=1 to 1000:next i
  114.  1100 return
  115.  1110 rem enter data routine
  116.  1120 printcr$:print
  117.  1130 print"what column number do you wish(1-12)
  118.  1140 inputcl
  119.  1150 if cl=13 or cl=14 or cl=15 thenprint"reserved for totals":goto1130
  120.  1160 print:print"how many rows do you want to work with(1-50)"
  121.  1170 inputk
  122.  1180 print:print"row","current","column";cl
  123.  1190 for y=1 to k
  124.  1200 print:printy,v(cl,y),:fori=1to11:printchr$(157);:next:inputv:v(cl,y)=v
  125.  1210 next y
  126.  1220 print"enter 'c' for another column"
  127.  1230 print"'m' for the menu.";
  128.  1240 getd$:if d$="" then 1240
  129.  1250 ifd$="c"then 1120
  130.  1260 return
  131.  1270 rem calculation menu
  132.  1280 printcr$
  133.  1290 print"you may choose any of the following"
  134.  1300 print"  1. sum all columns...............1450
  135.  1310 print"  2. sum all rows..................1600
  136.  1320 print"  3. reproduce any column..........1710
  137.  1330 print"  4. add,mult,div,sub,at any point.1790
  138.  1340 print"  5. average all columns...........2170
  139.  1350 print"  6. all rows as % of base row.....2250
  140.  1360 print"  7. all col as % of base col......2370
  141.  1370 print"  8. sum individual col........... 2560
  142.  1380 print"  9. unused                ........2510
  143.  1390 print" 'm' returns you to main menu"
  144.  1400 print:print"which one?";
  145.  1410 get an$:if an$=""then1410
  146.  1420 if an$="m" then return
  147.  1430 on val(an$)gosub 1450,1600,1710,1790,2170,2250,2370,2560,2490
  148.  1440 goto1280
  149.  1450 rem sum all colmns
  150.  1460 printcr$"do you wish to designate the rows to  be summed?"
  151.  1470 geta$:ifa$=""then1470
  152.  1480 ifa$="n"then s1=1:s2=49:goto 1500
  153.  1490 print:input"sum rows between s1,s2";s1,s2
  154.  1500 printcr$;ct$:print"summing columns >               "
  155.  1510 for x=1 to 14
  156.  1520 v(x,s2+1)=0
  157.  1530 next x
  158.  1540 for x=1 to 14:printchr$(145)tab(22)x
  159.  1550 for y=s1to s2
  160.  1560 v(x,s2+1)=v(x,s2+1)+v(x,y)
  161.  1570 next y
  162.  1580 next x
  163.  1590 return
  164.  1600 rem sum all rows
  165.  1610 printcr$;ct$:print"summing rows >                  "
  166.  1620 for y=1 to 48
  167.  1630 v(13,y)=0
  168.  1640 next y
  169.  1650 for y=1 to 48:printchr$(145)tab(22)y
  170.  1660 for x=1 to 12
  171.  1670 v(13,y)=v(13,y)+v(x,y)
  172.  1680 next x
  173.  1690 next y
  174.  1700 return
  175.  1710 rem reproduce any col
  176.  1720 printcr$:input"which col do you wish";cx
  177.  1730 printcr$;ct$:print"duplicating col"cx" into col >            "
  178.  1740 for x=cx+1 to 12:printchr$(145)tab(32)x
  179.  1750 for y=1 to 49
  180.  1760 v(x,y)=v(cx,y)
  181.  1770 next y:next x
  182.  1780 return
  183.  1790 rem add,mult,sub,div,exchg at any point
  184.  1800 printcr$"do you wish to "
  185.  1810 print"  1.add  2.mult  3.sub  4.div  5.exchg "
  186.  1820 geta$:if a$="" then 1820
  187.  1830 if val(a$)<1 or val(a$)>5 then 1800
  188.  1840 on val(a$)goto 1850,1910,1970,2030,2100
  189.  1850 rem add
  190.  1860 input"enter the amount you want added";ad
  191.  1870 input"what col #";x
  192.  1880 input"what row #";y
  193.  1890 v(x,y)=v(x,y)+ad
  194.  1900 goto 2160
  195.  1910 rem mult routine
  196.  1920 printcr$:input"enter the amount to mult by";ml
  197.  1930 input"what col #";x
  198.  1940 input"what row #";y
  199.  1950 v(x,y)=v(x,y)*ml
  200.  1960 goto 2160
  201.  1970 rem sub routine
  202.  1980 printcr$:input"enter the amount to be sub";sb
  203.  1990 input"what col #";x
  204.  2000 input"what row #";y
  205.  2010 v(x,y)=v(x,y)-sb
  206.  2020 goto 2160
  207.  2030 rem div routine
  208.  2040 printcr$:input"enter the amount to div by";dv
  209.  2050 input"what col #";x
  210.  2060 input"what row #";y
  211.  2070 v(x,y)=v(x,y)/dv
  212.  2080 v(x,y)=int(v(x,y)*1000+.5)/1000
  213.  2090 goto 2160
  214.  2100 rem exchg routine
  215.  2110 printcr$:input"enter amount to be exchged";ex
  216.  2120 input"what col #";x
  217.  2130 input"what row #";y
  218.  2140 v(x,y)=ex
  219.  2150 goto 2160
  220.  2160 return
  221.  2170 rem average the col
  222.  2180 printcr$:input"enter the number of cols to be averaged";ave
  223.  2190 printcr$;ct$:print"averaging columns.. row >        "
  224.  2200 for y=1 to 50:printchr$(145)tab(27)y
  225.  2210 if v(13,y)=0 then 2230
  226.  2220 v(14,y)=v(13,y)/ave:v(14,y)=int(v(14,y)*1000+.5)/1000
  227.  2230 next y
  228.  2240 return
  229.  2250 rem rows as %of base row
  230.  2260 printcr$:input"which is your base row";br
  231.  2270 printcr$;ct$:print"all rows as % of row"br
  232.  2280 print"calculating col >            "
  233.  2290 for x=1 to 13:printchr$(145)tab(20)x
  234.  2300 for y=1 to 50
  235.  2310 if y=br then2340
  236.  2320 if v(x,br)=0 then 2340
  237.  2330 v(x,y)=v(x,y)/v(x,br):v(x,y)=int(v(x,y)*10000+.5)/100
  238.  2340 next y
  239.  2350 next x
  240.  2360 return
  241.  2370 rem all col as % of base col
  242.  2380 printcr$:input"which is your base col";cx
  243.  2390 printcr$;ct$:print"all cols as % of col"cx
  244.  2400 print"calculating row >              "
  245.  2410 for y=1 to 50:printchr$(145)tab(20)y
  246.  2420 for x=1 to 12
  247.  2430 if x=cx then 2460
  248.  2440 if v(cx,y)=0 then 2460
  249.  2450 v(x,y)=v(x,y)/v(cx,y):v(x,y)=int(v(x,y)*10000+.5)/100
  250.  2460 next x
  251.  2470 next y
  252.  2480 return
  253.  2490 rem this section not used
  254.  2500 return
  255.  2510 :
  256.  2520 :
  257.  2530 :
  258.  2540 :
  259.  2550 :
  260.  2560 rem sum single col
  261.  2570 printchr$(147)"Which col do you want to sum?"
  262.  2580 inputca: ifca<1orca>15then2580
  263.  2590 print:print"do you wish to sum certain  rows (y/n)?"
  264.  2600 getyn$:ifyn$<>"y"andyn$<>"n"then2600
  265.  2610 ifyn$="y"thengosub 2680:goto2630
  266.  2620 s1=1:s2=49
  267.  2630 v(ca,s2+1)=0
  268.  2640 fory=s1tos2
  269.  2650 v(ca,s2+1)=v(ca,s2+1)+v(ca,y)
  270.  2660 nexty
  271.  2670 return
  272.  2680 rem set  up designated rows
  273.  2690 input"enter rows to be summed in this col (s1,s2)";s1,s2
  274.  2700 return
  275.  2710 rem set up series of calc
  276.  2720 print:print"how many calculations do you want in this  series (1-8)?"
  277.  2730 getnm$:ifnm$=""then2730
  278.  2740 ifval(nm$)<0orval(nm$)>8then2730
  279.  2750 nm=val(nm$):ifnm=0thenreturn
  280.  2760 print"enter operations you choose in the order they are to be performed"
  281.  2770 fori=1tonm
  282.  2780 print"enter operation #";i;
  283.  2790 getop(i):ifop(i)<1orop(i)>8then2790
  284.  2800 printop(i)
  285.  2810 nexti
  286.  2820 fori=1tonm
  287.  2830 onop(i)gosub 1450,1600,1710,1790,2170,2250,2370,2560
  288.  2840 nexti
  289.  2850 return
  290.  2860 rem print  data routine
  291.  2870 printchr$(147)"make sure printer is on dummy...hit any key when ready."
  292.  2880 print"hit 'm' to return to menu"
  293.  2890 geta$:ifa$=""then2890
  294.  2900 ifa$="m"then return
  295.  2910 print"do you want  to  designate the rows to be printed?"
  296.  2920 geta$:ifa$=""then2920
  297.  2930 ifa$="n"then s1=1:s2=50:goto2960
  298.  2940 input"enter rows to be printed s1,s2";s1,s2
  299.  2950 sp$=chr$(29)
  300.  2960 open 3,4,0:open 2,4,2:open 1,4,1:open4,4,4
  301.  2970 print#2,"aaa 99  aaaaaaaa  99999999  99999999  999.99   s99999999
  302.  2980 print#3,"col",," 1"," 2"," 3"," 4"
  303.  2990 print#3,
  304.  3000 fory=s1tos2
  305.  3010 print#1,"row"sp$,y,,v(1,y),v(2,y),v(3,y),v(4,y)
  306.  3020 nexty:print#3:goto3160
  307.  3030 print#3,"col",," 5"," 6"," 7"," 8"
  308.  3040 fory=s1tos2
  309.  3050 print#1,"row"sp$,y,,v(5,y),v(6,y),v(7,y),v(8,y)
  310.  3060 nexty:print#3
  311.  3070 print#3,"col",," 9","10","11","12"
  312.  3080 fory=s1tos2
  313.  3090 print#1,"row"sp$,y,l$(y)sp$,v(9,y),v(10,y),v(11,y),v(12,y)
  314.  3100 nexty:print#3
  315.  3110 print#2,"aaa 99  aaaaaaaa  9999999.99  9999999.99  9999999.99"
  316.  3120 print#3,"col",,"13","14","15"
  317.  3130 fory=s1tos2
  318.  3140 print#1,"row"sp$,y,,v(13,y),v(14,y),v(15,y)
  319.  3150 nexty
  320.  3160 print#4:close4:close3:close2:close1: return
  321. ready.
  322.